// CherryMerry ( Mikhail Tomilenko ), Reverse Entertainment, 2021-2024

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "EnemyHealthManager.generated.h"


UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class NIFESTGAME_API UEnemyHealthManager : public UActorComponent
{
	GENERATED_BODY()

public:	
	UEnemyHealthManager();

protected:
	virtual void BeginPlay() override;

	bool bHasShield;
	bool bIsDead;
	bool bCanDamage;

	FTimerHandle DeathTimerHandle;

	UFUNCTION()
	void TakeDamage(AActor* DamagedActor, float Damage, const class UDamageType* DamageType, class AController* InstigatedBy, AActor* DamageCauser);

	void Death();
	void AfterDeath();

public:	
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	float MaxHealth;
	float MaxShield;

	UPROPERTY(BlueprintReadOnly)
	float CurrentHealth;
	
	UPROPERTY(BlueprintReadOnly)
	float CurrentShield;
};
